package com.diudiutechnology.www.yadiudiu.util.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.EditText;

/**
 * Created by Administrator on 2017/8/18.
 * 解决 ScrollView 嵌套EditText
 */

public class MyEditText extends EditText{
    private MyEditText mthis;

    public MyEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mthis = this;
        // TODO Auto-generated constructor stub
    }
    public MyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        mthis = this;
        // TODO Auto-generated constructor stub
    }

//	private PointF c

    public MyEditText(Context context) {
        super(context);
        mthis = this;
        // TODO Auto-generated constructor stub
    }

    @Override
    public boolean onTouchEvent(MotionEvent e) {
        if(e.getAction()==MotionEvent.ACTION_DOWN){

            //通知父控件不要干扰
            getParent().requestDisallowInterceptTouchEvent(true);
        }else if(e.getAction()==MotionEvent.ACTION_MOVE){

            //通知父控件不要干扰
            getParent().requestDisallowInterceptTouchEvent(true);
        }else if(e.getAction()==MotionEvent.ACTION_UP){

//			getParent().requestDisallowInterceptTouchEvent(true);
        }
        return super.onTouchEvent(e);
    }
}
